package com.automobile.backstage.dao;


import com.automobile.backstage.domain.MakeApp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MakeAppDao  {

    @Insert("insert into make(licensePlateNumber" +
            ",carID" +
            ",theRegistrationTimeFrom" +
            ",theRegistrationTimeTo" +
            ",brand,km" +
            ",type" +
            ",makeDate" +
            ",makeTime" +
            ",phone" +
            ",name" +
            ",identityCard" +
            ",address" +
            ",content) " +
            "values(#{licensePlateNumber}" +
            ",#{carID}" +
            ",#{theRegistrationTimeFrom}" +
            ",#{theRegistrationTimeTo}" +
            ",#{brand}" +
            ",#{km}" +
            ",#{type}" +
            ",#{makeDate}" +
            ",#{makeTime}" +
            ",#{phone}" +
            ",#{name}" +
            ",#{identityCard}" +
            ",#{address}" +
            ",#{content}" +
            ")"
    )
    void save(MakeApp makeApp);

	@Select("select * from make ORDER BY id DESC")
    List<MakeApp> findAll() throws Exception;

	@Select("select * from make where id = #{id}")
    MakeApp findMakeAppById(Integer id) throws Exception;

	@Delete("delete from make where id = #{id}")
    void del(Integer id) throws Exception;
	
}
